package com.ihisun.tmhcms.core.service.projectservice.impl;

import com.ihisun.tmhcms.core.dao.doctordao.DoctorDao;
import com.ihisun.tmhcms.core.dao.projectdao.ProjectBannerDao;
import com.ihisun.tmhcms.core.dao.projectdao.ProjectDao;
import com.ihisun.tmhcms.core.service.projectservice.ProjectService;
import com.ihisun.tmhcms.core.vo.DoctorVo;
import com.ihisun.tmhcms.core.vo.ProjectBannerVo;
import com.ihisun.tmhcms.core.vo.ProjectVo;
import com.ihisun.tmhcms.utils.ResponseVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProjectServiceImpl implements ProjectService {
    @Resource
    ProjectDao projectDao;
    @Resource
    ProjectBannerDao projectBannerDao;
    @Resource
    DoctorDao doctorDao;
    @Override
    public ResponseVo projectInfo(String projectId) {
        ProjectVo byProjectId = projectDao.findByProjectId(projectId);
        List<ProjectBannerVo> byProjectid = projectBannerDao.findByProjectId(projectId);
        byProjectId.setProjectBannerVos(byProjectid);
        DoctorVo byDoctorId = doctorDao.findByDoctorId(byProjectId.getDoctorId());
        byProjectId.setDoctorVo(byDoctorId);
        return ResponseVo.ok(byProjectId);
    }
}
